package com.linkhub.oms.admin.modules.satoken.listener;

import cn.dev33.satoken.listener.SaTokenListenerForSimple;
import cn.dev33.satoken.session.SaSession;
import cn.dev33.satoken.stp.SaLoginModel;
import cn.dev33.satoken.stp.StpUtil;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @Description: LhSaTokenListener
 * @Author: echo
 * @Date: 2024/3/15 21:31
 * @Version: 1.0
 */
@Slf4j
@Component
public class LhSaTokenListener extends SaTokenListenerForSimple {
    @Override
    public void doLogin(String loginType, Object loginId, String tokenValue, SaLoginModel loginModel) {
        SaSession saSession = StpUtil.getSessionByLoginId(loginId);
        saSession.refreshDataMap(Maps.newHashMap());
        log.info("saSessionId=[{}] refreshDataMap", saSession.getId());
    }
}
